home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
fontfx1a
/
fontmod.bas
< prev
next >
Wrap
BASIC Source File
|
1999-09-12
|
11KB
|
183 lines
Attribute VB_Name = "Fontmod"
Option Explicit
' Ok, well here is a breif explination
' This will do a few things with text.
' I could of named it Text FX or PicBox FX,
' But I like Font FX better I made the subs
' as customizable as I could think of, If
' you hav any suggestions, please email
' me at MaRZ001@juno.com
' If you want and if I impliment your idea
' I will put you in a greets thing or something
' Well, I know I said the 11th, and of course I
' put it off and put it off, until the 10th so
' I did this in maby 5 hours total so I could
' have it ready by the 11th.
' If you don't know what a X, Y axis is, here
' is a breif explination. The Y is up and down
' the X is left and right. Just cause its there,
' the Z axis is like for 3D movements and stuff,
' If I'm wrong on any of the Axis things...
' email me and tell me, or if u got a better
' short explination, email me. I think I'm right
' on the X and Y, but I don't know too much bout
' the Z. K, I think thats enough reading for now:)
Public Const Left = 1 'Const for X axis
Public Const Top = 1 'Const for Y axis
Public Const Middle = 2 'Const for X, Y axis
Public Const Bottom = 3 'Const for Y axis
Public Const Right = 3 'Const for X axis
Public Sub Pause(HowLong As String) 'The pause, I found strings work better
Dim TheBeginning
TheBeginning = Timer
Do While Timer < TheBeginning + HowLong
DoEvents
Loop
End Sub
Sub TxtBottom(Txt As String, Delay As String, Increment As Integer, XPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = 0
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If XPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentX = 0 'Left
ElseIf XPos = 2 Then 'Middle
PicBox.CurrentX = PicBox.ScaleWidth / 2 - (PicBox.TextWidth(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf XPos = 3 Then 'Bottom
PicBox.CurrentX = PicBox.ScaleHeight - (PicBox.TextWidth(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% + Increment% 'Add in the increment so it will move
PicBox.CurrentY = a% 'Set the Y axis to what the increment has been changed to
b% = PicBox.TextHeight(Txt$) + PicBox.CurrentY 'Check to see where the Y axis is plus the text Height
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .003 is a good pause time
Loop Until b% >= PicBox.ScaleHeight 'Stop looping if the Y axis has reached the Bottom of the picture box
End Sub
Sub TxtDiagTopLeft(Txt As String, Delay As String, PicBox As PictureBox)
Dim a As Integer, b As Integer, c As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = PicBox.ScaleHeight - PicBox.TextHeight(Txt)
c% = 0
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
b% = PicBox.ScaleWidth / PicBox.ScaleHeight 'gets the scale of the height to width
a% = a% - 1 'Add in the increment so it will move
PicBox.CurrentY = a% 'Set the Y axis to what the increment has been changed to
c% = c% + b% 'Add in the increment so it will move
PicBox.CurrentX = c% 'Set the X axis to what the increment has been changed to
b% = PicBox.CurrentX 'Check to see where the X axis is
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .003 is a good pause time
Loop Until b% >= PicBox.ScaleWidth - PicBox.TextWidth(Txt) - 30 'Stop looping if the X axis has reached the Right of the picture box
End Sub
Sub TxtDiagTopRight(Txt As String, Delay As String, PicBox As PictureBox)
Dim a As Integer, b As Integer, c As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = PicBox.ScaleHeight - PicBox.TextHeight(Txt)
c% = PicBox.ScaleWidth - PicBox.TextWidth(Txt)
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
b% = PicBox.ScaleWidth / PicBox.ScaleHeight 'gets the scale of the height to width
a% = a% - 1 'Add in the increment so it will move
PicBox.CurrentY = a% 'Set the Y axis to what the increment has been changed to
c% = c% - b% 'Add in the increment so it will move
PicBox.CurrentX = c% 'Set the X axis to what the increment has been changed to
b% = PicBox.CurrentX 'Check to see where the X axis is
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .003 is a good pause time
Loop Until b% <= 0 + 30 'Stop looping if the X axis has reached the Left of the picture box
End Sub
Sub TxtTop(Txt As String, Delay As String, Increment As Integer, XPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = PicBox.ScaleHeight - PicBox.TextHeight(Txt)
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If XPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentX = 0 'Left
ElseIf XPos = 2 Then 'Middle
PicBox.CurrentX = PicBox.ScaleWidth / 2 - (PicBox.TextWidth(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf XPos = 3 Then 'Bottom
PicBox.CurrentX = PicBox.ScaleHeight - (PicBox.TextWidth(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% - Increment% 'Add in the increment so it will move
PicBox.CurrentY = a% 'Set the X axis to what the increment has been changed to
b% = PicBox.CurrentY 'Check to see where the Y axis is
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .003 is a good pause time
Loop Until b% <= 0 'Stop looping if the Y axis has reached the Top of the picture box
End Sub
Sub TxtRight(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = 0
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If YPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentY = 0 'Top
ElseIf YPos = 2 Then 'Middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf YPos = 3 Then 'Bottom
PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% + Increment% 'Add in the increment so it will move
PicBox.CurrentX = a% 'Set the X axis to what the increment has been changed to
b% = PicBox.FontSize + PicBox.TextWidth(Txt$) + PicBox.CurrentX 'Check to see where the X axis is plus the font size and text width
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .003 is a good pause time
Loop Until b% >= PicBox.ScaleWidth 'Stop looping if the X axis has reached the Right of the picture box
End Sub
Sub TxtLeft(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = PicBox.ScaleWidth - (PicBox.TextWidth(Txt) + PicBox.FontSize)
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If YPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentY = 0 'Top
ElseIf YPos = 2 Then 'Middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf YPos = 3 Then 'Bottom
PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% - Increment% 'Add in the increment s